package o;

import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import o.aaf.c;

public abstract class zv<Z> extends aab<ImageView, Z> implements c {
    @Nullable
    private Animatable ˏ;

    protected abstract void ॱ(@Nullable Z z);

    public zv(ImageView imageView) {
        super(imageView);
    }

    public void ˏ(Drawable drawable) {
        ((ImageView) this.ˊ).setImageDrawable(drawable);
    }

    public void onLoadStarted(@Nullable Drawable drawable) {
        super.onLoadStarted(drawable);
        ˏ(null);
        ˏ(drawable);
    }

    public void onLoadFailed(@Nullable Drawable drawable) {
        super.onLoadFailed(drawable);
        ˏ(null);
        ˏ(drawable);
    }

    public void onLoadCleared(@Nullable Drawable drawable) {
        super.onLoadCleared(drawable);
        if (this.ˏ != null) {
            this.ˏ.stop();
        }
        ˏ(null);
        ˏ(drawable);
    }

    public void onResourceReady(@NonNull Z z, @Nullable aaf<? super Z> o_aaf__super_Z) {
        if (o_aaf__super_Z == null || !o_aaf__super_Z.ॱ(z, this)) {
            ˏ((Object) z);
        } else {
            ˎ(z);
        }
    }

    public void onStart() {
        if (this.ˏ != null) {
            this.ˏ.start();
        }
    }

    public void onStop() {
        if (this.ˏ != null) {
            this.ˏ.stop();
        }
    }

    private void ˏ(@Nullable Z z) {
        ॱ(z);
        ˎ(z);
    }

    private void ˎ(@Nullable Z z) {
        if (z instanceof Animatable) {
            this.ˏ = (Animatable) z;
            this.ˏ.start();
            return;
        }
        this.ˏ = null;
    }
}
